Hotfix: Upload of XML files to form not working#1033
Merged
McNamara84 merged 15 commits intomainfrom Apr 2, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses regressions in the XML upload flow (field population + JS initialization robustness) and aligns autosave draft handling between frontend and backend, while adding regression coverage to prevent recurrences.
Changes:
- Backend: return
204 No Contentwhen a draft is missing (instead of404), and update PHP API tests accordingly. - Frontend JS: harden initialization against translation/help race conditions; clear stale autosave draft IDs when drafts are missing; remove noisy logging for empty curated keywords; fix duplicate upload-modal IDs.
- Tests/docs: add Playwright regression flows and expand Jest coverage for translation guards and autosave edge cases; update changelog.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
api/v2/controllers/DraftController.php |
Changes missing-draft response to 204 and suppresses storage-root mkdir warnings. |
js/services/autosaveService.js |
Clears stale draftId on 204/404 during draft lookup. |
js/language.js |
Adds guard in applyTranslations() to avoid race-condition errors when translations aren’t loaded. |
js/descriptionTypes.js |
Wraps translation/help updates in try/catch to ensure promise resolution even on JS errors. |
js/freekeywordTags.js |
Removes console logging when curated keywords list is empty. |
modals.html |
Fixes duplicate IDs by introducing modal-uploadxml-label and updating aria-labelledby. |
doc/changelog.html |
Notes the XML upload fix in the changelog. |
tests/DraftControllerTest.php |
Adds coverage for 204 on missing drafts. |
tests/ApiTest.php |
Updates lifecycle expectations to match 204 for deleted/missing drafts. |
tests/js/autosaveService.test.js |
Adds unit tests for stale draftId clearing on 204/404. |
tests/js/language.module.test.js |
Adds tests for applyTranslations() early-return guards. |
tests/js/descriptionTypes.test.js |
Adds tests ensuring initDescriptionTypes() resolves even if downstream calls throw. |
tests/js/freekeywordTags.test.js |
Updates expectation to reflect removed logging behavior. |
tests/playwright/flows/stage-diagnosis.spec.ts |
Adds regression checks for init errors, modal ID uniqueness, and XML upload population. |
tests/playwright/flows/xml-upload-datacite47.spec.ts |
Adds an end-to-end XML upload flow covering many mapped fields and console error filtering. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and bug fixes across the backend, frontend, and test suites, with a focus on robustness, error handling, and regression prevention. The most significant changes are the switch of the draft "not found" response from HTTP 404 to 204 (No Content), improved handling of race conditions and error states in JavaScript, fixes for modal accessibility and duplicate IDs, and the addition of comprehensive regression and unit tests.
Changes
Draft API and Autosave Handling
DraftController.php) and OpenAPI docs (swagger.yaml). Autosave logic and tests were updated to handle this new behavior, ensuring stale draft IDs are cleared only on 204, and 404 is now treated as a configuration error. [1] [2] [3] [4] [5] [6]Frontend Robustness and Error Handling
applyTranslations(language.js) andinitDescriptionTypes(descriptionTypes.js), ensuring UI initialization does not fail if AJAX or translation loading order varies. [1] [2]Accessibility and Modal Fixes
modals.htmlby separating the modal and label IDs, improving accessibility and preventing HTML validation issues.Regression and Unit Testing
Documentation and Changelog
Notes for Reviewer
Please test if ELMO-generated XML files can be uploaded and will seed the input fields.
Checklist
Known Issues
None.